<template>
    <div>
        <h3>AddItem组件</h3>
        <p>已知库存数：{{ $store.state.count }}</p>
        <button @click="addFn">库存+1</button>
        <div>总消费：{{ $store.getters.totalPrice }}</div>
    </div>
</template>

<script>
export default{
     data(){
        return{
            
        }
     },
     methods:{
        addFn(){
            // this.$store.commit('addCount',1)
            this.$store.dispatch('asyncAddCount') //触发vuex => actions
        }
     }
}
</script>

<style>

</style>